const { list, deleteRecord } = require('./data/user-roles')

const base = '/userserver'

module.exports = [{
  url: `${base}/userRoles/user/[1-9][0-9]*`,
  type: 'get',
  response: config => {
    const id = config.url.match(/[1-9][0-9]*/)
    return { success: true, data: list(id) }
  }
}, {
  url: `${base}/userRoles/[1-9][0-9]*`,
  type: 'delete',
  response: config => {
    const id = config.url.match(/[1-9][0-9]*/)
    deleteRecord(id)
    return { success: true }
  }
}]
